/****************************************
*  This file created using "Writer B"   *
*      a program written by CTonk       *
*          ctonk87@hotmail.com          *
*     [timestamp 03/04/06  18:23:07]    *
****************************************/

// Character.cpp

#ifndef CPP_CHARACTER
#define CPP_CHARACTER

#include "Character.h"


// Constructors...
Character::Character()
{
	_connection = 0;
	_pword = new char[20];
	for ( int x=0; x < 20; x++ )
		_pword[x] = '\0';
	_lname = new char[13];
	for ( int x=0; x < 13; x++ )
		_lname[x] = '\0';
	_prof = new char[20];
	for ( int x=0; x < 20; x++ )
		_prof[x] = '\0';
	_clan = new char[20];
	for ( int x=0; x < 20; x++ )
		_clan[x] = '\0';
	_goldheld = 0;
	_bankgold = 0;
	_silverheld = 0;
	_banksilver = 0;
	_room = new Room;
	_mobdeaths = 0;
	_mobkills = 0;
	_pkdeaths = 0;
	_pkkills = 0;
	_exp = 0;
	_tnl = 0;
	_pracs = 0;
	_trains = 0;
	_gains = 0;
	_on = false;
	_onpedit = false;
	_ontick = false;
	_onreset = false;
	_onlogs = false;
	_title = new char[80];
	for ( int x=0; x < 80; x++ )
		_title[x] = '\0';
	_eyedesc = new char[20];
	for ( int x=0; x < 20; x++ )
		_eyedesc[x] = '\0';
	_eyecolor = new char[20];
	for ( int x=0; x < 20; x++ )
		_eyecolor[x] = '\0';
	_hairdesc = new char[20];
	for ( int x=0; x < 20; x++ )
		_hairdesc[x] = '\0';
	_haircolor = new char[20];
	for ( int x=0; x < 20; x++ )
		_haircolor[x] = '\0';
	_cheight = new char[20];
	for ( int x=0; x < 20; x++ )
		_cheight[x] = '\0';
	_cweight = new char[20];
	for ( int x=0; x < 20; x++ )
		_cweight[x] = '\0';
	_hand = 0;
	_house = new char[28];
	for ( int x=0; x < 28; x++ )
		_house[x] = '\0';
	_points = 0;
	_echocolor = 'x';
}

Character::Character( Character& it )
{
	_connection = it._connection;
	for ( int x=0; x < 20; x++ )
		_pword[x] = it._pword[x];
	for ( int x=0; x < 13; x++ )
		_lname[x] = it._lname[x];
	for ( int x=0; x < 20; x++ )
		_prof[x] = it._prof[x];
	for ( int x=0; x < 20; x++ )
		_clan[x] = it._clan[x];
	_goldheld = it._goldheld;
	_bankgold = it._bankgold;
	_silverheld = it._silverheld;
	_banksilver = it._banksilver;
	*_room = *(it._room);
	_mobdeaths = it._mobdeaths;
	_mobkills = it._mobkills;
	_pkdeaths = it._pkdeaths;
	_pkkills = it._pkkills;
	_exp = it._exp;
	_tnl = it._tnl;
	_pracs = it._pracs;
	_trains = it._trains;
	_gains = it._gains;
	_on = it._on;
	_onpedit = it._onpedit;
	_ontick = it._ontick;
	_onreset = it._onreset;
	_onlogs = it._onlogs;
	for ( int x=0; x < 80; x++ )
		_title[x] = it._title[x];
	for ( int x=0; x < 20; x++ )
		_eyedesc[x] = it._eyedesc[x];
	for ( int x=0; x < 20; x++ )
		_eyecolor[x] = it._eyecolor[x];
	for ( int x=0; x < 20; x++ )
		_hairdesc[x] = it._hairdesc[x];
	for ( int x=0; x < 20; x++ )
		_haircolor[x] = it._haircolor[x];
	for ( int x=0; x < 20; x++ )
		_cheight[x] = it._cheight[x];
	for ( int x=0; x < 20; x++ )
		_cweight[x] = it._cweight[x];
	_hand = it._hand;
	for ( int x=0; x < 28; x++ )
		_house[x] = it._house[x];
	_points = it._points;
	_echocolor = it._echocolor;
}

Character::~Character()
{
	delete[] _pword;
	delete[] _lname;
	delete[] _prof;
	delete[] _clan;
	delete _room;
	delete[] _title;
	delete[] _eyedesc;
	delete[] _eyecolor;
	delete[] _hairdesc;
	delete[] _haircolor;
	delete[] _cheight;
	delete[] _cweight;
	delete[] _house;
}

// Operators...
Character& Character::operator = ( Character& it )
{
	_connection = it._connection;
	for ( int x=0; x < 20; x++ )
		_pword[x] = it._pword[x];
	for ( int x=0; x < 13; x++ )
		_lname[x] = it._lname[x];
	for ( int x=0; x < 20; x++ )
		_prof[x] = it._prof[x];
	for ( int x=0; x < 20; x++ )
		_clan[x] = it._clan[x];
	_goldheld = it._goldheld;
	_bankgold = it._bankgold;
	_silverheld = it._silverheld;
	_banksilver = it._banksilver;
	*_room = *(it._room);
	_mobdeaths = it._mobdeaths;
	_mobkills = it._mobkills;
	_pkdeaths = it._pkdeaths;
	_pkkills = it._pkkills;
	_exp = it._exp;
	_tnl = it._tnl;
	_pracs = it._pracs;
	_trains = it._trains;
	_gains = it._gains;
	_on = it._on;
	_onpedit = it._onpedit;
	_ontick = it._ontick;
	_onreset = it._onreset;
	_onlogs = it._onlogs;
	for ( int x=0; x < 80; x++ )
		_title[x] = it._title[x];
	for ( int x=0; x < 20; x++ )
		_eyedesc[x] = it._eyedesc[x];
	for ( int x=0; x < 20; x++ )
		_eyecolor[x] = it._eyecolor[x];
	for ( int x=0; x < 20; x++ )
		_hairdesc[x] = it._hairdesc[x];
	for ( int x=0; x < 20; x++ )
		_haircolor[x] = it._haircolor[x];
	for ( int x=0; x < 20; x++ )
		_cheight[x] = it._cheight[x];
	for ( int x=0; x < 20; x++ )
		_cweight[x] = it._cweight[x];
	_hand = it._hand;
	for ( int x=0; x < 28; x++ )
		_house[x] = it._house[x];
	_points = it._points;
	_echocolor = it._echocolor;
	return *this;
}

// Public accessor methods...
int Character::GetConnection() {
	return _connection;
}

void Character::SetConnection( int connection ) {
	_connection = connection;
}

char* Character::GetPword( void ) {
	return _pword;
}

char Character::GetPword( int x ) {
	return _pword[x];
}

void Character::SetPword( char* val ) {
	strcpy( _pword, val );
	return;
}

void Character::SetPword( const char* val ) {
	strcpy( _pword, val );
	return;
}

void Character::SetPword( int x, char val ) {
	_pword[x] = val;
}

char* Character::GetLname( void )
{
	return _lname;
}

char Character::GetLname( int x )
{
	return _lname[x];
}

void Character::SetLname( char* val )
{
	strcpy( _lname, val );
	return;
}

void Character::SetLname( const char* val )
{
	strcpy( _lname, val );
	return;
}

void Character::SetLname( int x, char val )
{
	_lname[x] = val;
}

char* Character::GetProf( void )
{
	return _prof;
}

char Character::GetProf( int x )
{
	return _prof[x];
}

void Character::SetProf( char* val )
{
	strcpy( _prof, val );
	return;
}

void Character::SetProf( const char* val )
{
	strcpy( _prof, val );
	return;
}

void Character::SetProf( int x, char val )
{
	_prof[x] = val;
}

char* Character::GetClan( void )
{
	return _clan;
}

char Character::GetClan( int x )
{
	return _clan[x];
}

void Character::SetClan( char* val )
{
	strcpy( _clan, val );
	return;
}

void Character::SetClan( const char* val )
{
	strcpy( _clan, val );
	return;
}

void Character::SetClan( int x, char val )
{
	_clan[x] = val;
}

int Character::GetGoldheld() {
	return _goldheld;
}

void Character::SetGoldheld( int goldheld ) {
	_goldheld = goldheld;
	return;
}

int Character::GetBankgold() {
	return _bankgold;
}

void Character::SetBankgold( int bankgold ) {
	_bankgold = bankgold;
	return;
}

int Character::GetSilverheld() {
	return _silverheld;
}

void Character::SetSilverheld( int silverheld ) {
	_silverheld = silverheld;
	return;
}

int Character::GetBanksilver() {
	return _banksilver;
}

void Character::SetBanksilver( int banksilver ) {
	_banksilver = banksilver;
	return;
}

int Character::GetMobdeaths()
{
	return _mobdeaths;
}

void Character::SetMobdeaths( int mobdeaths )
{
	_mobdeaths = mobdeaths;
}

int Character::GetMobkills()
{
	return _mobkills;
}

void Character::SetMobkills( int mobkills )
{
	_mobkills = mobkills;
}

int Character::GetPkdeaths()
{
	return _pkdeaths;
}

void Character::SetPkdeaths( int pkdeaths )
{
	_pkdeaths = pkdeaths;
}

int Character::GetPkkills()
{
	return _pkkills;
}

void Character::SetPkkills( int pkkills )
{
	_pkkills = pkkills;
}

int Character::GetExp()
{
	return _exp;
}

void Character::SetExp( int exp )
{
	_exp = exp;
}

int Character::GetTnl()
{
	return _tnl;
}

void Character::SetTnl( int tnl )
{
	_tnl = tnl;
}

int Character::GetPracs()
{
	return _pracs;
}

void Character::SetPracs( int pracs )
{
	_pracs = pracs;
}

int Character::GetTrains()
{
	return _trains;
}

void Character::SetTrains( int trains )
{
	_trains = trains;
}

int Character::GetGains()
{
	return _gains;
}

void Character::SetGains( int gains )
{
	_gains = gains;
}

bool Character::GetOn()
{
	return _on;
}

void Character::SetOn( bool on )
{
	_on = on;
}

bool Character::GetOnpedit()
{
	return _onpedit;
}

void Character::SetOnpedit( bool onpedit )
{
	_onpedit = onpedit;
}

bool Character::GetOntick()
{
	return _ontick;
}

void Character::SetOntick( bool ontick )
{
	_ontick = ontick;
}

bool Character::GetOnreset()
{
	return _onreset;
}

void Character::SetOnreset( bool onreset )
{
	_onreset = onreset;
}

bool Character::GetOnlogs()
{
	return _onlogs;
}

void Character::SetOnlogs( bool onlogs )
{
	_onlogs = onlogs;
}

char* Character::GetTitle( void )
{
	return _title;
}

char Character::GetTitle( int x )
{
	return _title[x];
}

void Character::SetTitle( char* val )
{
	strcpy( _title, val );
	return;
}

void Character::SetTitle( const char* val )
{
	strcpy( _title, val );
	return;
}

void Character::SetTitle( int x, char val )
{
	_title[x] = val;
}

char* Character::GetEyedesc( void )
{
	return _eyedesc;
}

char Character::GetEyedesc( int x )
{
	return _eyedesc[x];
}

void Character::SetEyedesc( char* val )
{
	strcpy( _eyedesc, val );
	return;
}

void Character::SetEyedesc( const char* val )
{
	strcpy( _eyedesc, val );
	return;
}

void Character::SetEyedesc( int x, char val )
{
	_eyedesc[x] = val;
}

char* Character::GetEyecolor( void )
{
	return _eyecolor;
}

char Character::GetEyecolor( int x )
{
	return _eyecolor[x];
}

void Character::SetEyecolor( char* val )
{
	strcpy( _eyecolor, val );
	return;
}

void Character::SetEyecolor( const char* val )
{
	strcpy( _eyecolor, val );
	return;
}

void Character::SetEyecolor( int x, char val )
{
	_eyecolor[x] = val;
}

char* Character::GetHairdesc( void )
{
	return _hairdesc;
}

char Character::GetHairdesc( int x )
{
	return _hairdesc[x];
}

void Character::SetHairdesc( char* val )
{
	strcpy( _hairdesc, val );
	return;
}

void Character::SetHairdesc( const char* val )
{
	strcpy( _hairdesc, val );
	return;
}

void Character::SetHairdesc( int x, char val )
{
	_hairdesc[x] = val;
}

char* Character::GetHaircolor( void )
{
	return _haircolor;
}

char Character::GetHaircolor( int x )
{
	return _haircolor[x];
}

void Character::SetHaircolor( char* val )
{
	strcpy( _haircolor, val );
	return;
}

void Character::SetHaircolor( const char* val )
{
	strcpy( _haircolor, val );
	return;
}

void Character::SetHaircolor( int x, char val )
{
	_haircolor[x] = val;
}

char* Character::GetCheight( void )
{
	return _cheight;
}

char Character::GetCheight( int x )
{
	return _cheight[x];
}

void Character::SetCheight( char* val )
{
	strcpy( _cheight, val );
	return;
}

void Character::SetCheight( const char* val )
{
	strcpy( _cheight, val );
	return;
}

void Character::SetCheight( int x, char val )
{
	_cheight[x] = val;
}

char* Character::GetCweight( void )
{
	return _cweight;
}

char Character::GetCweight( int x )
{
	return _cweight[x];
}

void Character::SetCweight( char* val )
{
	strcpy( _cweight, val );
	return;
}

void Character::SetCweight( const char* val )
{
	strcpy( _cweight, val );
	return;
}

void Character::SetCweight( int x, char val )
{
	_cweight[x] = val;
}

int Character::GetHand()
{
	return _hand;
}

void Character::SetHand( int hand )
{
	_hand = hand;
}

char* Character::GetHouse( void )
{
	return _house;
}

char Character::GetHouse( int x )
{
	return _house[x];
}

void Character::SetHouse( char* val )
{
	strcpy( _house, val );
	return;
}

void Character::SetHouse( const char* val )
{
	strcpy( _house, val );
	return;
}

void Character::SetHouse( int x, char val )
{
	_house[x] = val;
}

int Character::GetPoints()
{
	return _points;
}

void Character::SetPoints( int points )
{
	_points = points;
}

char Character::GetEchocolor() {
	return _echocolor;
}

void Character::SetEchocolor( char echocolor ) {
	_echocolor = echocolor;
	return;
}

// Other methods...
void Character::Display( std::ostream& out )
{
	out << "-Character-";
	out << "\nLname: " << _lname;
	out << "\nProf: " << _prof;
	out << "\nClan: " << _clan;
	out << "\nGoldheld: " << _goldheld;
	out << "\nSilverheld: " << _silverheld;
	out << '\n';	_room->Display( out );
	out << "\nMobdeaths: " << _mobdeaths;
	out << "\nMobkills: " << _mobkills;
	out << "\nPkdeaths: " << _pkdeaths;
	out << "\nPkkills: " << _pkkills;
	out << "\nExp: " << _exp;
	out << "\nTnl: " << _tnl;
	out << "\nPracs: " << _pracs;
	out << "\nTrains: " << _trains;
	out << "\nGains: " << _gains;
	out << "\nOn: " << _on;
	out << "\nOnpedit: " << _onpedit;
	out << "\nOntick: " << _ontick;
	out << "\nOnreset: " << _onreset;
	out << "\nOnlogs: " << _onlogs;
	out << "\nTitle: " << _title;
	out << "\nEyedesc: " << _eyedesc;
	out << "\nEyecolor: " << _eyecolor;
	out << "\nHairdesc: " << _hairdesc;
	out << "\nHaircolor: " << _haircolor;
	out << "\nCheight: " << _cheight;
	out << "\nCweight: " << _cweight;
	out << "\nHand: " << _hand;
	out << "\nHouse: " << _house;
	out << "\nPoints: " << _points;
	return;
}

void Character::Display( std::string& out )
{
	out << "-Character-";
	out << "\nLname: " << _lname;
	out << "\nProf: " << _prof;
	out << "\nClan: " << _clan;
	out << "\nGoldheld: " << _goldheld;
	out << "\nSilverheld: " << _silverheld;
	out << '\n';	_room->Display( out );
	out << "\nMobdeaths: " << _mobdeaths;
	out << "\nMobkills: " << _mobkills;
	out << "\nPkdeaths: " << _pkdeaths;
	out << "\nPkkills: " << _pkkills;
	out << "\nExp: " << _exp;
	out << "\nTnl: " << _tnl;
	out << "\nPracs: " << _pracs;
	out << "\nTrains: " << _trains;
	out << "\nGains: " << _gains;
	out << "\nOn: " << _on;
	out << "\nOnpedit: " << _onpedit;
	out << "\nOntick: " << _ontick;
	out << "\nOnreset: " << _onreset;
	out << "\nOnlogs: " << _onlogs;
	out << "\nTitle: " << _title;
	out << "\nEyedesc: " << _eyedesc;
	out << "\nEyecolor: " << _eyecolor;
	out << "\nHairdesc: " << _hairdesc;
	out << "\nHaircolor: " << _haircolor;
	out << "\nCheight: " << _cheight;
	out << "\nCweight: " << _cweight;
	out << "\nHand: " << _hand;
	out << "\nHouse: " << _house;
	out << "\nPoints: " << _points;
	return;
}

void Character::Save() {
	char* file = new char[100];
	init( file );
	strcpy( file, "save/" );
	if ( this->_level <= KING )
		strcat( file, "players/" );
	else
		strcat( file, "admins/" );
	strcat( file, this->_name );
	strcat( file, ".pfile" );

	std::ofstream save( file );

	this->Csave( save );

	save << "\n\n//Character Data...";
	save << "\nLname: " << _lname;
	save << "\nProf: " << _prof;
	save << "\nClan: " << _clan;
	save << "\nBankgold: " << _bankgold;
	save << "\nBanksilver: " << _banksilver;
	save << "\nRoom: " << _room->GetVnum();
	save << "\nKills: " << _mobdeaths << ' ' << _mobkills << ' ' << _pkdeaths << ' ' << _pkkills;
	save << "\nExp/Tnl: " << _exp << ' ' << _tnl;
	save << "\nPracs/Trains/Gains: " << _pracs << ' ' << _trains << ' ' << _gains;
	save << "\nOmniNet: " << _on << ' ' << _onpedit << ' ' << _ontick << ' ' << _onreset << ' ' << _onlogs;
	save << "\nTitle: " << _title;
	save << "\nEyes: " << _eyedesc << ' ' << _eyecolor;
	save << "\nHair: " << _hairdesc << ' ' << _haircolor;
	save << "\nCheight: " << _cheight;
	save << "\nCweight: " << _cweight;
	save << "\nHand: " << _hand;
	save << "\nHouse: " << _house;
	save << "\nPoints: " << _points;

	save.close();

	return;
}

void Character::Load() {
	char* file = new char[100];
	init( file );
	strcpy( file, "save/" );
	if ( this->_level <= KING )
		strcat( file, "players/" );
	else
		strcat( file, "admins/" );
	strcat( file, this->_name );
	strcat( file, ".pfile" );

	std::ifstream load( file );

	this->Cload( load );

	return;
}




#endif // #ifndef CPP_CHARACTER
